import request from '@/utils/request'

export default {
  /**
   * 添加课程信息
   * @param {*} courseInfo
   * @returns
   */
  saveCourseInfo(courseInfo) {
    return request({
      url: '/service-edu/admin/edu/course/save-course-info',
      method: 'post',
      data: courseInfo
    })
  },
  /**
   * 根据id查询课程信息
   * @param {*} id
   * @returns
   */

  getCourseInfoById(id) {
    return request({
      url: `/service-edu/admin/edu/course/course-info/${id}`,
      method: 'get'
    })
  },
  /**
   * 更新课程信息
   * @param {*} courseInfo
   * @returns
   */
  updateCourseInfoById(courseInfo) {
    return request({
      url: '/service-edu/admin/edu/course/course-info/update',
      method: 'put',
      data: courseInfo
    })
  },
  /**
   * 分页查询课程
   * @param {*} currentPage
   * @param {*} size
   * @param {*} searchObj
   * @returns
   */
  getCoursePage(currentPage, size, searchObj) {
    return request({
      url: `/service-edu/admin/edu/course/list/${currentPage}/${size}`,
      method: 'get',
      params: searchObj
    })
  },
  /**
   * 根据id删除课程
   * @param {*} id
   * @returns
   */
  removeCourseById(id) {
    return request({
      url: `/service-edu/admin/edu/course/remove/${id}`,
      method: 'delete'
    })
  },
  /**
   * 根据id发布课程信息
   * @param {*} id
   * @returns
   */
  getCoursePublishById(id) {
    return request({
      url: `/service-edu/admin/edu/course/course-publish/${id}`,
      method: 'get'
    })
  },
  /**
   * 发布课程 最终
   * @param {*} id
   * @returns
   */
  publishCourse(id) {
    return request({
      url: `/service-edu/admin/edu/course/publish-course/${id}`,
      method: 'get'
    })
  }

}
